package com.qh.yyxt.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.qh.yyxt.entity.Borrow;
import com.qh.yyxt.pojo.entity.meeting.DelayBorrow;
import com.qh.yyxt.pojo.entity.meeting.User;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@AllArgsConstructor
@NoArgsConstructor
@Data
public class BorrowDTO
{
    //记录id
    private Integer id;
    //用户id
    private Integer uid;
    //会议室id
    private Integer mid;
    //会议名称
    private String name;
    //会议室名称
    private String midName;
    //会议内容
    private String text;
    //开始时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date starttime;
    //结束时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date endtime;
    //申请提交时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date time;
    //参会人数
    private Integer num;
    //联系方式
    private String tel;
    //备注
    private String mes;
    //经办人
    private String handler;
    //预计请的领导
    private String leader;
    //负责人
    private String director;
    //话筒数量
    private Integer micro_num;
    //无线话筒
    private Integer wireless_num;
    //茶杯数量
    private Integer cup_num;
    //桌子摆放形式
    private String control;
    //公安处备案情况
    private String security;
    //状态:待审批、审批通过、已撤销、会议结束、未通过
    private String state;
    //用户名
    private String userName;
    private String uName;
    private String tel1;
    private String tel2;
    private String tel3;
    //延时申请信息
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date delaytime;
    //申请延时的状态
    private String delaystate;

    public void set(Borrow b, User u, DelayBorrow delayBorrow)
    {
        System.out.println(b);
        if(b!=null) {
            id = b.getId();
            wireless_num=b.getWirelessNum();
            uid = b.getUid();
            mid = b.getMid();
            name = b.getName();
            text = b.getText();
            starttime = b.getStarttime();
            endtime = b.getEndtime();
            time = b.getTime();
            num = b.getNum();
            tel = b.getTel();
            mes = b.getMes();
            handler = b.getHandler();
            leader = b.getLeader();
            director = b.getDirector();
            micro_num=b.getMicroNum();
            cup_num=b.getCupNum();
            control=b.getControl();
            security=b.getSecurity();
            state = b.getState();
        }
        if(u!=null){
        userName=u.getUsername();
        uName=u.getName();
        tel1 = u.getTel1();
        tel2=u.getTel2();
        tel3=u.getTel3();
        }
        if(delayBorrow!=null)
        {
            delaystate=delayBorrow.getDelaystate();
            delaytime =delayBorrow.getDelaytime();
        }
    }
}
